package terra.network.packet.server;

import org.jboss.netty.buffer.ChannelBuffer;

import terra.network.packet.Packet;

public class LightInfo extends Packet {

	public float x,y;
	public int id;
	public int oId;
	public float radius;
	public byte lights;
	
	
	public LightInfo() {
	}

	@Override
	public ChannelBuffer toBuffer() {

		ChannelBuffer buf = getNewBuffer();
		buf.writeByte(getId());
		buf.writeInt(oId);	
		buf.writeFloat(x);
		buf.writeFloat(y);	
		buf.writeInt(id);
		buf.writeFloat(radius);	
		buf.writeByte(lights);		
		return buf;
	}

	@Override
	public Packet fromBuffer(ChannelBuffer buf) {
		oId = buf.readInt();
		x = buf.readFloat();
		y = buf.readFloat();
		id = buf.readInt();
		radius = buf.readFloat();
		lights = buf.readByte();
		return this;
	}

	@Override
	public int getLength() {
		return 22;
	}

	@Override
	public boolean isDynamicLength() {
		return false;
	}

	@Override
	public byte getId() {
		return 29;
	}
	
	@Override
	public byte getPriority() {
		return PRIOR_NORMAL;
	}

}
